package com.system.business.controller;

import com.system.business.been.IntervalPlanLst;
import com.system.business.service.IntervalPlanLstService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 林
 */
@RestController
@RequestMapping("/intervalPlanLst")
public class IntervalPlanLstController {
    @Autowired
    private IntervalPlanLstService intervalPlanLstService;

    @PostMapping("/save")
    public boolean saveHandle(@RequestBody IntervalPlanLst intervalPlanLst){
        return intervalPlanLstService.saveIntervalPlanLst(intervalPlanLst);
    }

    @DeleteMapping("/del/{id}")
    public boolean deleteHandle(@PathVariable("id") int id){
        return intervalPlanLstService.removeIntervalPlanLstById(id);
    }

    @PutMapping("/update")
    public boolean updateHandle(@RequestBody IntervalPlanLst intervalPlanLst){
        return intervalPlanLstService.modifyIntervalPlanLst(intervalPlanLst);
    }

    @GetMapping("/get/{id}")
    public IntervalPlanLst getHandle(@PathVariable("id") int id){
        return intervalPlanLstService.getIntervalPlanLstById(id);
    }

    @GetMapping("/get/list")
    public List<IntervalPlanLst> listHandle(){
        return intervalPlanLstService.listAllIntervalPlanLst();
    }
    @GetMapping("/get/findAllByIntervalPlanId/{intervalPlanId}")
    public List<IntervalPlanLst> findAllByIntervalPlanId(@PathVariable("intervalPlanId") int intervalPlanId){
        return intervalPlanLstService.findAllByIntervalPlanId(intervalPlanId);
    }
}
